﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="picSelect.aspx.cs" Inherits="MxWeiXinPF.Web.admin.picmgr.picSelect" %>

<!DOCTYPE html>
<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <meta name="viewport" content="width=device-width,minimum-scale=1.0,maximum-scale=1.0,initial-scale=1.0,user-scalable=no" />
    <meta name="apple-mobile-web-app-capable" content="yes" />
    <title>选择图片</title>

    <%=PageJSAndStype("edit").ToString() %>

    <script src="../../scripts/jquery/jquery.query.js"></script>

    <script type="text/javascript">

        var api = top.dialog.get(window); //获取父窗体对象
        $(function () {
            //设置按钮及事件
            api.button([{
                value: '确定',
                callback: function () {
                    selectedIco();
                    return false;

                },
                autofocus: true
            }, {
                value: '取消',
                callback: function () { }
            }
            ]);

            //初始化表单验证
            $("#form1").initValidform();

            //初始化上传控件

            $(".upload-attach").InitUploader({ filesize: "<%=siteConfig.imgsize %>", sendurl: "../../tools/upload_ajax.ashx", swf: "../../scripts/webuploader/uploader.swf", filetypes: "<%=siteConfig.fileextension %>" });


        });

        function selectedIco() {

            var selectPicValue = "";

            if ($("#div_userupload").is(":hidden")) {

                if ($('input:radio[name="radPic"]:checked').val() == undefined) {
                    //说明没有选中任意一个选项
                }
                else {
                    var val = $('input:radio[name="radPic"]:checked').val();
                    selectPicValue = val;
                }
            }
            else {
                selectPicValue = $("#txtFileName").val();
            }


            if (selectPicValue == "") {
                top.dialog({
                    title: '提示',
                    content: '没有找到已上传附件，请上传！',
                    okValue: '确定',
                    ok: function () { }
                }).showModal(api);
                return false;
            }

            api.close(selectPicValue).remove();




        }
    </script>


    <style type="text/css">
        #div_piclist {
            margin-left: 10px;
        }
    </style>
</head>
<body>
    <form id="form1" runat="server">

        <div class="div-content">
            <dl>
                <dt>选择：</dt>
                <dd>
                    <div class="rule-single-select">
                        <asp:DropDownList ID="ddlTemplates" runat="server" AutoPostBack="True" OnSelectedIndexChanged="ddlTemplates_SelectedIndexChanged"></asp:DropDownList>
                    </div>

                </dd>
            </dl>
            <div id="div_piclist" runat="server" style="display: none;">
                <table>
                    <tr>
                        <td>
                            <ul class="picUl">

                                <!--图片列表-->
                                <asp:Repeater ID="rptList2" runat="server">

                                    <ItemTemplate>
                                        <li>
                                            <label for="rad<%#Eval("id")%>" class="picLabel">
                                                <table class="picTable">
                                                    <tr>
                                                        <td class="picTd">
                                                            <img src="<%#Eval("picUri")%>" />
                                                        </td>
                                                    </tr>
                                                    <tr>
                                                        <td class="chkTd" style="line-height: 20px;">
                                                            <input id="rad<%#Eval("id")%>" class="radPic" name="radPic" value="<%#Eval("picUri")%>" type="radio" />
                                                            <label><%#Eval("picName")%></label>
                                                        </td>
                                                    </tr>
                                                </table>
                                            </label>
                                        </li>
                                    </ItemTemplate>
                                    <FooterTemplate>
                                        <%#rptList2.Items.Count == 0 ? "<div align=\"center\" style=\"font-size:12px;line-height:30px;color:#666;\">暂无记录</div>" : ""%>
                                    </FooterTemplate>
                                </asp:Repeater>
                                <!--/图片列表-->
                                <%-- <asp:Literal ID="litPicStr" runat="server" EnableViewState="false"></asp:Literal>--%>
                            </ul>

                        </td>

                    </tr>

                </table>
                <!--内容底部-->
                <div class="line20"></div>
                <div class="pagelist">
                    <div class="l-btns">
                        <span>显示</span><asp:TextBox ID="txtPageNum" runat="server" CssClass="pagenum" onkeydown="return checkNumber(event);" OnTextChanged="txtPageNum_TextChanged" AutoPostBack="True"></asp:TextBox><span>条/页</span>
                    </div>
                    <div id="PageContent" runat="server" class="default"></div>
                </div>
                <!--/内容底部-->

            </div>
            <div class="dl-attach-box" id="div_userupload" runat="server">

                <dl>
                    <dt>上传：</dt>
                    <dd>


                        <input type="text" id="txtFileName" class="input normal upload-path" />
                        <div class="upload-box upload-attach"></div>

                    </dd>
                </dl>
                <dl>
                    <dt>说明：</dt>
                    <dd>推荐宽300高300像素正方形图片，个别模版需要宽720高400像素图片</dd>
                </dl>


            </div>
        </div>
    </form>
</body>
</html>
